home *** CD-ROM | disk | FTP | other *** search
/ Borland JBuilder 6 / jbuilder6.iso / IBM VisualAge for Java Enterprise v4.0 Retail / ivj40 / setup / IDE.Cab / F77576_BasicSmartGuideButtonsUI.class (.txt) < prev    next >
Encoding:
Java Class File  |  2000-04-25  |  4.6 KB  |  202 lines

  1. package com.ibm.ivb.sguides.basic;
  2.  
  3. import com.ibm.ivb.sguides.MultiCellContainer;
  4. import com.ibm.ivb.sguides.SGButton;
  5. import com.ibm.ivb.sguides.SmartGuide;
  6. import com.ibm.ivb.sguides.SmartGuideButtons;
  7. import com.ibm.ivb.sguides.SmartGuideButtonsUI;
  8. import javax.swing.JComponent;
  9. import javax.swing.JLabel;
  10. import javax.swing.event.ChangeEvent;
  11. import javax.swing.event.ChangeListener;
  12. import javax.swing.plaf.ComponentUI;
  13.  
  14. public class BasicSmartGuideButtonsUI extends SmartGuideButtonsUI implements ChangeListener {
  15.    private static final String kCBIBMCopyright = "(c) Copyright IBM Corporation 1998";
  16.    protected SmartGuideButtons sgbuttons;
  17.    // $FF: renamed from: ah com.ibm.ivb.sguides.basic.BasicSmartGuideButtonsUI.ActionHandler
  18.    ActionHandler field_0 = new ActionHandler(this);
  19.    // $FF: renamed from: ea com.ibm.ivb.sguides.basic.BasicSmartGuideButtonsUI.EnterAction
  20.    EnterAction field_1;
  21.  
  22.    public static ComponentUI createUI(JComponent var0) {
  23.       return new BasicSmartGuideButtonsUI();
  24.    }
  25.  
  26.    protected void installListeners() {
  27.       this.field_1 = new EnterAction(this.sgbuttons);
  28.       this.sgbuttons.backButton.addActionListener(this.field_0);
  29.       this.sgbuttons.nextButton.addActionListener(this.field_0);
  30.       this.sgbuttons.finishButton.addActionListener(this.field_0);
  31.       this.sgbuttons.cancelButton.addActionListener(this.field_0);
  32.       if (this.sgbuttons.helpButton != null) {
  33.          this.sgbuttons.helpButton.addActionListener(this.field_0);
  34.       }
  35.  
  36.    }
  37.  
  38.    public void installUI(JComponent var1) {
  39.       this.sgbuttons = (SmartGuideButtons)var1;
  40.       this.makeButtons(0, true);
  41.       MultiCellContainer var2 = new MultiCellContainer();
  42.       var2.setPadding(2, 0);
  43.       var2.setFill(1);
  44.       var2.setWeight(1, 1);
  45.       var2.setInsets(3, 10, 6, 8);
  46.       var2.addToCell(this.sgbuttons.infoLabel, 0, 0);
  47.       var2.setFill(3);
  48.       var2.setAnchor(13);
  49.       var2.setWeight(0, 1);
  50.       var2.setInsets(3, 0, 6, 8);
  51.       var2.addToCell(this.sgbuttons.cancelButton, 1, 0);
  52.       var2.setInsets(3, 0, 6, 0);
  53.       var2.addToCell(this.sgbuttons.backButton, 2, 0);
  54.       var2.addToCell(this.sgbuttons.nextButton, 3, 0);
  55.       var2.setInsets(3, 8, 6, 8);
  56.       var2.addToCell(this.sgbuttons.finishButton, 4, 0);
  57.       var2.setInsets(3, 4, 6, 8);
  58.       var2.addToCell(this.sgbuttons.helpButton, 5, 0);
  59.       this.sgbuttons.setWeight(1, 1);
  60.       this.sgbuttons.addToCell(var2, 0, 0);
  61.       this.installListeners();
  62.    }
  63.  
  64.    protected void makeButtons(int var1, boolean var2) {
  65.       SmartGuide var3 = this.sgbuttons.getSmartGuide();
  66.       this.sgbuttons.backButton = new SGButton((String)var3.getClientProperty("BackButtonText"));
  67.       this.sgbuttons.backButton.setType(var1);
  68.       Character var4 = (Character)var3.getClientProperty("BackButtonM");
  69.       if (var4 != null) {
  70.          this.sgbuttons.backButton.setMnemonic(var4);
  71.       }
  72.  
  73.       this.sgbuttons.nextButton = new SGButton((String)var3.getClientProperty("NextButtonText"));
  74.       this.sgbuttons.nextButton.setType(var1);
  75.       var4 = (Character)var3.getClientProperty("NextButtonM");
  76.       if (var4 != null) {
  77.          this.sgbuttons.nextButton.setMnemonic(var4);
  78.       }
  79.  
  80.       this.sgbuttons.finishButton = new SGButton((String)var3.getClientProperty("FinishButtonText"));
  81.       this.sgbuttons.finishButton.setType(var1);
  82.       var4 = (Character)var3.getClientProperty("FinishButtonM");
  83.       if (var4 != null) {
  84.          this.sgbuttons.finishButton.setMnemonic(var4);
  85.       }
  86.  
  87.       this.sgbuttons.cancelButton = new SGButton((String)var3.getClientProperty("CancelButtonText"));
  88.       this.sgbuttons.cancelButton.setType(var1);
  89.       var4 = (Character)var3.getClientProperty("CancelButtonM");
  90.       if (var4 != null) {
  91.          this.sgbuttons.cancelButton.setMnemonic(var4);
  92.       }
  93.  
  94.       if (this.sgbuttons.isHelpAvailable()) {
  95.          this.sgbuttons.helpButton = new SGButton((String)var3.getClientProperty("HelpButtonText"));
  96.          this.sgbuttons.helpButton.setType(var1);
  97.          var4 = (Character)var3.getClientProperty("HelpButtonM");
  98.          if (var4 != null) {
  99.             this.sgbuttons.helpButton.setMnemonic(var4);
  100.          }
  101.       }
  102.  
  103.       if (var2) {
  104.          this.sgbuttons.infoLabel = new JLabel(this.sgbuttons.getInfo());
  105.       }
  106.  
  107.    }
  108.  
  109.    public void stateChanged(ChangeEvent var1) {
  110.       if (this.sgbuttons.infoLabel != null) {
  111.          this.sgbuttons.infoLabel.setText(this.sgbuttons.getInfo());
  112.       }
  113.  
  114.       this.sgbuttons.invalidate();
  115.       this.sgbuttons.validate();
  116.       this.sgbuttons.repaint();
  117.    }
  118.  
  119.    protected void uninstallListeners() {
  120.       this.sgbuttons.backButton.removeActionListener(this.field_0);
  121.       this.sgbuttons.nextButton.removeActionListener(this.field_0);
  122.       this.sgbuttons.finishButton.removeActionListener(this.field_0);
  123.       this.sgbuttons.cancelButton.removeActionListener(this.field_0);
  124.       if (this.sgbuttons.helpButton != null) {
  125.          this.sgbuttons.helpButton.removeActionListener(this.field_0);
  126.       }
  127.  
  128.    }
  129.  
  130.    public void uninstallUI(JComponent var1) {
  131.       this.sgbuttons.removeAll();
  132.    }
  133.  
  134.    public void updateProperty(String var1, Object var2) {
  135.       if (var2 != null) {
  136.          if (var1 == "BackButtonText") {
  137.             this.sgbuttons.backButton.setText((String)var2);
  138.          } else {
  139.             if (var1 == "BackButtonM") {
  140.                Character var3 = (Character)var2;
  141.                if (var3 != null) {
  142.                   this.sgbuttons.backButton.setMnemonic(var3);
  143.                   return;
  144.                }
  145.             } else {
  146.                if (var1 == "NextButtonText") {
  147.                   this.sgbuttons.nextButton.setText((String)var2);
  148.                   return;
  149.                }
  150.  
  151.                if (var1 == "NextButtonM") {
  152.                   Character var4 = (Character)var2;
  153.                   if (var4 != null) {
  154.                      this.sgbuttons.nextButton.setMnemonic(var4);
  155.                      return;
  156.                   }
  157.                } else {
  158.                   if (var1 == "FinishButtonText") {
  159.                      this.sgbuttons.finishButton.setText((String)var2);
  160.                      return;
  161.                   }
  162.  
  163.                   if (var1 == "FinishButtonM") {
  164.                      Character var5 = (Character)var2;
  165.                      if (var5 != null) {
  166.                         this.sgbuttons.finishButton.setMnemonic(var5);
  167.                         return;
  168.                      }
  169.                   } else {
  170.                      if (var1 == "CancelButtonText") {
  171.                         this.sgbuttons.cancelButton.setText((String)var2);
  172.                         return;
  173.                      }
  174.  
  175.                      if (var1 == "CancelButtonM") {
  176.                         Character var6 = (Character)var2;
  177.                         if (var6 != null) {
  178.                            this.sgbuttons.cancelButton.setMnemonic(var6);
  179.                            return;
  180.                         }
  181.                      } else {
  182.                         if (var1 == "HelpButtonText") {
  183.                            this.sgbuttons.helpButton.setText((String)var2);
  184.                            return;
  185.                         }
  186.  
  187.                         if (var1 == "HelpButtonM") {
  188.                            Character var7 = (Character)var2;
  189.                            if (var7 != null) {
  190.                               this.sgbuttons.helpButton.setMnemonic(var7);
  191.                            }
  192.                         }
  193.                      }
  194.                   }
  195.                }
  196.             }
  197.  
  198.          }
  199.       }
  200.    }
  201. }
  202.